package edu.gmu.foxhound;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class SettingsActivity extends Activity{
	SharedPreferences settings;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_settings);
		settings = this.getSharedPreferences(this.getString(R.string.settings), Context.MODE_PRIVATE);
		//initial settings setup
	}
	
	public void enableToast_onClick(View view){
		SharedPreferences.Editor editor = settings.edit();
		editor.putBoolean(this.getString(R.string.settings_toast_mode_silent), true);
		editor.commit();
		toast("Enable Toast");
	}
	
	public void disableToast_onClick(View view){
		SharedPreferences.Editor editor = settings.edit();
		editor.putBoolean(this.getString(R.string.settings_toast_mode_silent), false);
		editor.commit();
		toast("Disable Toast");
	}
	
	public void enableFoxhound_onClick(View view){
		SharedPreferences.Editor editor = settings.edit();
		editor.putLong(this.getString(R.string.settings_alarm_interval), Long.parseLong(this.getString(R.string.settings_alarm_interval_val)));
		editor.commit();
		toast("Enable Foxhound");
	}
	public void disableFoxhound_onClick(View view){
		SharedPreferences.Editor editor = settings.edit();
		editor.putLong(this.getString(R.string.settings_alarm_interval), 0L);
		editor.commit();
		toast("Disable Foxhound");
	}
	
	public void toast(String text){
		Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
	}
}

